package com.leinao.core;


import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * description
 *
 * @author zhong.wang
 * @date 2025/1/13
 */
public class RegularPointConverter {

    private static final RegularPointConverter INSTANCE = new RegularPointConverter();
    private Map<Long,List<Long>> idPool = new ConcurrentHashMap<>();

    private RegularPointConverter() {
        idPool = new ConcurrentHashMap<>(1 << 10);
    }

    public synchronized void addRelation(Long left, List<Long> right){
        idPool.putIfAbsent(left, right);
    }

    public boolean hasId(Long id){
        return idPool.containsKey(id);
    }

    public List<Long> getByKey(Long id){
        return idPool.get(id);
    }
    public static RegularPointConverter getInstance() {
        return INSTANCE;
    }
}
